<?php
namespace Home\Controller;
use Think\Controller;

class ZwdsController extends Controller {
    public function index(){
        indexRvent();//测算首页执行事件
        cookie('orderidnum','Zwds');

        $this->assign('titleName',titleName('Zwds',1));//首页名称

        indexRequest($_REQUEST);//测算首页接收数据处理

        cnzz_pvuv('ZW');//执行统计
        //渠道获取ID
        $channelID=obtain_channelID('ZW');
        $this->assign('channelID',$channelID);

        $user_agent = $_SERVER['HTTP_USER_AGENT'];//用户使用的浏览器，操作系统等信息。
        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            cookie('wxlogin',0);
        }else{
            cookie('wxlogin',1);
            getToken();
            getTicket();
            $noncestr=noncestr(15);
            $timestamp=time();
            $ticket= S('ticket');
            $wzurl=wxJsdkData();
            $signature=sha1("jsapi_ticket={$ticket}&noncestr={$noncestr}&timestamp={$timestamp}&url={$wzurl}");

            $this->assign('appid',cookie('APPID'));
            $this->assign('timestamp',$timestamp);
            $this->assign('noncestr',$noncestr);
            $this->assign('signature',$signature);

            if(!empty($_REQUEST['code'])){
                cookie('code',$_REQUEST['code'],7100);
            }
            getCode($wzurl);
            getOopenid();

            wxShareUrl('ZW','Zwds');//分享地址获取
            cookie('uid',cookie('openid'));
        }

        //紫薇斗数随机数
        csRandNum('zwdscs',300000,499999);

        //半价
        $jieguoye=$_REQUEST['jieguoye'];
        banjia($jieguoye);

        $this->assign('imgPath',cookie('imgPath'));
        $this->assign('yearName',cookie('yearName'));

        $this->assign('orderidnum',cookie('orderidnum'));
        $this->display("Zwds/ZM_ziweidoushu");
    }
    public function zwds_zhifu(){
        $this->assign('titleName',titleName('Zwds',2));//首页名称
        $strData=mb_substr(cookie('orderid'),0,2);
        if($strData=='QS')cookie('orderid',null);
        cookie('timeStrto',time()+7200);//倒计时时间戳

        $user_agent = $_SERVER['HTTP_USER_AGENT'];//用户使用的浏览器，操作系统等信息。
        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            cookie('wxlogin',0);
        }else{
            cookie('wxlogin',1);

            $noncestr=noncestr(15);
            $timestamp=time();
            $ticket= S('ticket');
            $wzurl=wxJsdkData();
            $signature=sha1("jsapi_ticket={$ticket}&noncestr={$noncestr}&timestamp={$timestamp}&url={$wzurl}");

            $this->assign('appid',cookie('APPID'));
            $this->assign('timestamp',$timestamp);
            $this->assign('noncestr',$noncestr);
            $this->assign('signature',$signature);

        }
        cookie('orderidnum','Zwds');

        if($_REQUEST['birthday']==''){
            $birthday='0-2018-08-08-8';
        }else{
            $birthday=$_REQUEST['birthday'];
        }


        if($_REQUEST['username']){//返回操作
            cookie('znickname',I('post.username'),604800);
            cookie('zymd',mb_substr($birthday,2,10),7200);
            cookie('zhour',mb_substr($birthday,13,2),7200);
            cookie('zsex',$_REQUEST['gender'],604800);
            cookie('datetype',mb_substr($_REQUEST['birthday'],0,1));
        }elseif($_REQUEST['JGtype']==1){//结果页跳转下单
            $zymd=cookie('zymd');
            if(cookie('JGtypeZwds'.$zymd)){
            }else{
                cookie('orderid',null);
                cookie('JGtypeZwds'.$zymd,1,300);
            }
        }


        if(!empty($_REQUEST['ordernum'])){//未支付订单
            $arrdata[0]=S('sm_h5test|'.$_REQUEST['ordernum']);
            $zymd=$arrdata[0]['year'].'-'.str_pad($arrdata[0]['month'],2,"0",STR_PAD_LEFT).'-'.str_pad($arrdata[0]['day'],2,'0',STR_PAD_LEFT);
            cookie('zymd',$zymd,604800);
            cookie('zhour',$arrdata[0]['hour'],604800);
            cookie('znickname',$arrdata[0]['username'],604800);
            cookie('zsex',$arrdata[0]['sex'],604800);

            cookie('orderid',$_REQUEST['ordernum'],604800);
        }

        $y=mb_substr(cookie('zymd'),0,4);//年
        $m=mb_substr(cookie('zymd'),5,2); //月
        $d=mb_substr(cookie('zymd'),8,2);//日
        $zyinli=yinli($y,$m,$d);
        cookie('zyangli',$y.'年'.$m.'月'.$d.'日'.' '.cookie('zhour').'时',604800);//阳历
        cookie('zyinli',$zyinli[0].'年'.$zyinli[1].$zyinli[2],604800);//阴历

        $data=cookie('orderid');//获取订单号
        if(empty($data)&&empty($_REQUEST['ordernum'])){
            $orderid='ZW'.date('Ymd').mt_rand(100,999).date('His');
            cookie('orderid',$orderid,604800);
        }

        //创建订单
        $hour=cookie('zhour');if($hour=='')$hour=0;
        $shop=cookie('orderid');
        $znickname=cookie('znickname');if($znickname=='')$znickname='匿名';
        $zsex=cookie('zsex');if($zsex=='')$zsex=1;
        $channel=cookie('channel');
        $imei=cookie('uid');if(cookie('uid')==''){$imei=cookie('imei');}
        $y=mb_substr(cookie('zymd'),0,4);//年
        $m=mb_substr(cookie('zymd'),5,2); //月
        $d=mb_substr(cookie('zymd'),8,2);//日
        $datetype=cookie('datetype');if($datetype=='')$datetype=0;
        defaultPrice();
        channelPay($channel,'ZW');//查询渠道价格


        if(cookie('couponPrice')){//是否有使用优惠券
            cookie('price',cookie('couponPrice'));
            $this->assign('discount',10);//优惠券价格
        }else{
            $this->assign('discount',0);//优惠券价格
        }

        csPay($znickname,$channel);//测试价格判断

        $price=cookie('price');
        if(empty($_REQUEST['ordernum'])){
            $arrdata=S('sm_h5test|'.$shop);
            if(empty($arrdata)){
                $smH5testinter=array(
                    'ordernum'=>$shop, 'price'=>$price, 'username'=>$znickname, 'typeid'=>13, 'sex'=>$zsex, 'createtime'=>date('Y-m-d H:i:m'),
                    'status'=>-1, 'datetype'=>0, 'year'=>$y, 'month'=>$m, 'day'=>$d, 'hour'=>$hour,
                    'appuserid'=>$imei, 'ip'=>$_SERVER['REMOTE_ADDR'], 'channel'=>$channel, 'auto_send_sms'=>0, 'place'=>0,
                );
                S('sm_h5test|'.$shop,$smH5testinter,2592000);//2592000为30天
                cacheZhiFuOrderid($shop);//支付页缓存订单操作

                $IndexController=A('Index');//Index控制器
                $IndexController->subNumber('CY');//提交订单次数统计
            }else if(!cookie($_REQUEST['username'])){//返回操作
                //更新订单
                $arrdata['username']=$znickname;
                $arrdata['year']=$y;$arrdata['month']=$m;$arrdata['day']=$d;$arrdata['sex']=$zsex;
                S('sm_h5test|'.$shop,$arrdata,2592000);//2592000为30天
            }
        }

        $zymd= cookie('zymd');
        if(cookie('zsex')==1){
            $zsex='男';
        }else{
            $zsex='女';
        }
        if($zymd!=''){
            zwmp($zymd,cookie('zhour'),$zsex,'zw');
            $this->assign('mgwz',I('globals.mgwz'));
            $this->assign('position',I('globals.position'));
            $this->assign('seespouse',I('globals.see-spouse'));
            $this->assign('ny',I('globals.ny'));
            $this->assign('wedlock',I('globals.wedlock'));
            $this->assign('jyfraction',I('globals.jyfraction'));

            $this->assign('yysex',I('globals.yysex'));//阴阳男女
            $this->assign('tg',I('globals.tg'));//天干
            $this->assign('srg',I('globals.srg'));//十二宫
            $this->assign('wxj',I('globals.wxj'));//五行局
            $this->assign('arrzx',I('globals.arrzx'));//主星
            $this->assign('arrtf',I('globals.arrtf'));//天府
            $this->assign('syzx',I('globals.syzx'));//生月诸星
            $this->assign('snzx',I('globals.snzx'));//生年支系诸星
            $this->assign('mssnzx',I('globals.mssnzx'));//命身
            $this->assign('sxzx',I('globals.sxzx'));//时系诸星
            $this->assign('sngx',I('globals.sngx'));//生年干系诸星
            $this->assign('snjq',I('globals.snjq'));//生年将前12星
            $this->assign('snsq',I('globals.snsq'));//生年岁前12星
            $this->assign('snbs',I('globals.snbs'));//生年博士12星
            $this->assign('cssex',I('globals.cssex'));//长生12星
            $this->assign('dx',I('globals.dx'));//大限
            $this->assign('qtx',I('globals.qtx'));//其他星 如火星、铃星
            $this->assign('xx',I('globals.xx'));//小限
            $this->assign('shua',I('globals.shua'));//四化星
            $this->assign('lnlylr',I('globals.lnlylr'));//流年流月流日
            $this->assign('shengxiao',I('globals.shengxiao'));
            $sizhu=I('globals.sizhu');
            $this->assign('sizhu',$sizhu);//Z四柱
            $this->assign('dayun',I('globals.dayun'));//大运
            $this->assign('dayunx',I('globals.dayunx'));//大运x
            $this->assign('dayuny',I('globals.dayuny'));//大运y
            $this->assign('dayungz',I('globals.dayungz'));//大运干支
        }

        if($datetype==1){
            $this->assign('datetype',"农历 ".cookie('zyinli')." ".mb_substr($sizhu[3],1,1,'utf-8')."时");
        }else{
            $this->assign('datetype',"阳历 ".cookie('zyangli'));
        }

        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            if (strpos($user_agent, 'Windows') == true||strpos($user_agent,'Mac') == true) {
                //Windows 电脑访问
                if(channelSaoma($channel)){
                    $this->assign('pc',1);
                    $saomaUrl=wxsaoma('ZW','紫微斗数',cookie('orderid'));//微信扫码回调参数
                    $this->assign('wxsaoma',$saomaUrl);
                }
            }
        }else{
            $xml=wxgzhzf('ZW','紫微斗数',cookie('orderid'));//公众号支付回调参数
            $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
            $val = json_decode(json_encode($xmlstring),true);
            $noncestr=noncestr(15);//随机字符串
            $timestamp=time();//时间戳

            $stringA="appId=".cookie('APPID')."&nonceStr={$noncestr}&package=prepay_id={$val['prepay_id']}&signType=MD5&timeStamp={$timestamp}";
            $stringSignTemp=$stringA."&key=".cookie('wxKEY');
            $sign=strtoupper(md5($stringSignTemp));

            $this->assign('timeStamp',$timestamp);
            $this->assign('nonceStr',$noncestr);
            $this->assign('package','prepay_id='.$val['prepay_id']);
            $this->assign('signType','MD5');
            $this->assign('paySign',$sign);
            $this->assign('appId',cookie('APPID'));
        }

        $this->assign('csNameJump',U('Zwds/jieguoye','',false).'?ordernum='.cookie('orderid'));//支付成功跳转地址

        $this->assign('channel',cookie('channel'));
        $this->assign('orderidnum',cookie('orderidnum'));
        $this->assign('wxlogin',cookie('wxlogin'));
        $this->assign('sex',cookie('zsex'));
        $this->display("Zwds/ZM_ziweidoushu_zhifu");

    }
    public function jieguoye(){
        cookie('orderidnum','Zwds');
        jieguoInterface();//结果页公共函数
        $this->assign('titleName',titleName('Zwds',3));//首页名称
        $user_agent = $_SERVER['HTTP_USER_AGENT'];//用户使用的浏览器，操作系统等信息。
        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            cookie('wxlogin',0);
        }else{
            cookie('wxlogin',1);
            if($_SERVER['HTTP_HOST']==cookie('jieguoUrlYM')){

            }else{
                getToken();
                getTicket();
            }
            $noncestr=noncestr(15);
            $timestamp=time();
            $ticket= S('ticket');
            $wzurl=wxJsdkData();
            $signature=sha1("jsapi_ticket={$ticket}&noncestr={$noncestr}&timestamp={$timestamp}&url={$wzurl}");

            $this->assign('appid',cookie('APPID'));
            $this->assign('timestamp',$timestamp);
            $this->assign('noncestr',$noncestr);
            $this->assign('signature',$signature);
        }

        if(empty($_REQUEST['ordernum'])){
            $y=mb_substr(cookie('zymd'),0,4);//年
            $m=mb_substr(cookie('zymd'),5,2); //月
            $d=mb_substr(cookie('zymd'),8,2);//日
            $zyinli=yinli($y,$m,$d);
            cookie('zyangli',$y.'年'.$m.'月'.$d.'日'.' '.cookie('zhour').'时',604800);//阳历
            cookie('zyinli',$zyinli[0].'年'.$zyinli[1].$zyinli[2],604800);//阴历

            $zymd= cookie('zymd');
        }else{
            $ordernum=$_REQUEST['ordernum'];
            $arrdata[0]=jieguoyeArrData($ordernum);

            $zymd=$arrdata[0]['year'].'-'.str_pad($arrdata[0]['month'],2,"0",STR_PAD_LEFT).'-'.str_pad($arrdata[0]['day'],2,'0',STR_PAD_LEFT);
            cookie('zymd',$zymd,604800);
            cookie('zhour',$arrdata[0]['hour'],604800);
            cookie('znickname',$arrdata[0]['username'],604800);
            cookie('zsex',$arrdata[0]['sex'],604800);

            $y=mb_substr(cookie('zymd'),0,4);//年
            $m=mb_substr(cookie('zymd'),5,2); //月
            $d=mb_substr(cookie('zymd'),8,2);//日
            $zyinli=yinli($y,$m,$d);
            cookie('zyangli',$y.'年'.$m.'月'.$d.'日'.' '.cookie('zhour').'时',604800);//阳历
            cookie('zyinli',$zyinli[0].'年'.$zyinli[1].$zyinli[2],604800);//阴历

            $zymd= cookie('zymd');
            cookie('orderid',$arrdata[0]['ordernum'],604800);
        }

        jieguoyeRequest($arrdata[0]['status']);//结果页公共处理

        if(cookie('zsex')==1){
            $zsex='男';
        }else{
            $zsex='女';
        }
        if($zymd!=''){
            zwmp($zymd,cookie('zhour'),$zsex,'zw');
            $this->assign('mgwz',I('globals.mgwz'));
            $this->assign('position',I('globals.position'));
            $this->assign('seespouse',I('globals.see-spouse'));
            $this->assign('ny',I('globals.ny'));
            $this->assign('wedlock',I('globals.wedlock'));
            $this->assign('jyfraction',I('globals.jyfraction'));

            $this->assign('yysex',I('globals.yysex'));//阴阳男女
            $this->assign('tg',I('globals.tg'));//天干
            $this->assign('smgong',I('globals.smgong'));//命身宫
            $this->assign('srg',I('globals.srg'));//十二宫
            $this->assign('wxj',I('globals.wxj'));//五行局
            $this->assign('arrzx',I('globals.arrzx'));//主星
            $this->assign('arrtf',I('globals.arrtf'));//天府
            $this->assign('syzx',I('globals.syzx'));//生月诸星
            $this->assign('snzx',I('globals.snzx'));//生年支系诸星
            $this->assign('mssnzx',I('globals.mssnzx'));//命身主
            $this->assign('sxzx',I('globals.sxzx'));//时系诸星
            $this->assign('sngx',I('globals.sngx'));//生年干系诸星
            $this->assign('snjq',I('globals.snjq'));//生年将前12星
            $this->assign('snsq',I('globals.snsq'));//生年岁前12星
            $this->assign('snbs',I('globals.snbs'));//生年博士12星
            $this->assign('cssex',I('globals.cssex'));//长生12星
            $this->assign('dx',I('globals.dx'));//大限
            $this->assign('qtx',I('globals.qtx'));//其他星 如火星、铃星
            $this->assign('xx',I('globals.xx'));//小限
            $this->assign('shua',I('globals.shua'));//四化星
            $this->assign('lnlylr',I('globals.lnlylr'));//流年流月流日
            $this->assign('shengxiao',I('globals.shengxiao'));
            $this->assign('sizhu',I('globals.sizhu'));//Z四柱
            $this->assign('dayun',I('globals.dayun'));//大运
            $this->assign('dayunx',I('globals.dayunx'));//大运x
            $this->assign('dayuny',I('globals.dayuny'));//大运y
            $this->assign('dayungz',I('globals.dayungz'));//大运干支


            zsqk(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'));
            $this->assign('zsqkwz',I('globals.zsqkwz'));//自身情况
            $this->assign('zsqkzx',I('globals.zsqkzx'));//自身主星
            $this->assign('zsqkjx',I('globals.zsqkjx'));//自身吉星
            $this->assign('zsqkxx',I('globals.zsqkxx'));//自身凶星
            $this->assign('mggongwei',I('globals.mggongwei'));//自身宫位
            $this->assign('mgxj',I('globals.mgxj'));//自身宫位凶吉
            $this->assign('mgarrzhux',I('globals.mgarrzhux'));//自身主星状况
            $this->assign('mgarrfuxz',I('globals.mgarrfuxz'));//自身副星状况坐命宫
            $this->assign('mgarrfuxj',I('globals.mgarrfuxj'));//自身副星状况加会
            hyqg(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('hyqgwz',I('globals.hyqgwz'));//婚姻情感
            $this->assign('hyqgzx',I('globals.hyqgzx'));//婚姻主星
            $this->assign('hyqgjx',I('globals.hyqgjx'));//婚姻吉星
            $this->assign('hyqgxx',I('globals.hyqgxx'));//婚姻凶星
            $this->assign('fqgongwei',I('globals.fqgongwei'));//婚姻宫位
            $this->assign('fqxj',I('globals.fqxj'));//婚姻宫位凶吉
            $this->assign('fqarrzhux',I('globals.fqarrzhux'));//婚姻主星状况
            $this->assign('fqarrfuxz',I('globals.fqarrfuxz'));//婚姻副星状况坐命宫
            $this->assign('fqarrfuxj',I('globals.fqarrfuxj'));//婚姻副星状况加会
            cyzk(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('cyzkwz',I('globals.cyzkwz'));//财运状况
            $this->assign('cyzkzx',I('globals.cyzkzx'));//财运主星
            $this->assign('cyzkjx',I('globals.cyzkjx'));//财运吉星
            $this->assign('cyzkxx',I('globals.cyzkxx'));//财运凶星
            $this->assign('cbgongwei',I('globals.cbgongwei'));//财运宫位
            $this->assign('cbxj',I('globals.cbxj'));//财运宫位凶吉
            $this->assign('cbarrzhux',I('globals.cbarrzhux'));//财运主星状况
            $this->assign('cbarrfuxz',I('globals.cbarrfuxz'));//财运副星状况坐命宫
            $this->assign('cbarrfuxd',I('globals.cbarrfuxd'));//财运副星状况对照
            $this->assign('cbarrfuxj',I('globals.cbarrfuxj'));//财运副星状况加会
            syfz(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('syfzwz',I('globals.syfzwz'));//事业状况
            $this->assign('syfzzx',I('globals.syfzzx'));//事业主星
            $this->assign('syfzjx',I('globals.syfzjx'));//事业吉星
            $this->assign('syfzxx',I('globals.syfzxx'));//事业凶星
            $this->assign('sygongwei',I('globals.sygongwei'));//事业宫位
            $this->assign('syxj',I('globals.syxj'));//事业宫位凶吉
            $this->assign('syarrzhux',I('globals.syarrzhux'));//事业主星状况
            $this->assign('syarrfuxz',I('globals.syarrfuxz'));//事业副星状况坐命宫
            $this->assign('syarrfuxd',I('globals.syarrfuxd'));//事业副星状况对照
            $this->assign('syarrfuxj',I('globals.syarrfuxj'));//事业副星状况加会
            jkzt(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('jkztwz',I('globals.jkztwz'));//疾厄状况
            $this->assign('jkztzx',I('globals.jkztzx'));//疾厄主星
            $this->assign('jkztjx',I('globals.jkztjx'));//疾厄吉星
            $this->assign('jkztxx',I('globals.jkztxx'));//疾厄凶星
            $this->assign('jegongwei',I('globals.jegongwei'));//疾厄宫位
            $this->assign('jexj',I('globals.jexj'));//疾厄宫位凶吉
            $this->assign('jearrzhux',I('globals.jearrzhux'));//疾厄主星状况
            $this->assign('jearrfuxz',I('globals.jearrfuxz'));//疾厄副星状况坐命宫
            $this->assign('jearrfuxd',I('globals.jearrfuxd'));//疾厄副星状况对照
            $this->assign('jearrfuxj',I('globals.jearrfuxj'));//疾厄副星状况加会
            jsdx(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('jsdxwz',I('globals.jsdxwz'));//福德状况
            $this->assign('jsdxzx',I('globals.jsdxzx'));//福德主星
            $this->assign('jsdxjx',I('globals.jsdxjx'));//福德吉星
            $this->assign('jsdxxx',I('globals.jsdxxx'));//福德凶星
            $this->assign('fdgongwei',I('globals.fdgongwei'));//福德宫位
            $this->assign('fdxj',I('globals.fdxj'));//福德宫位凶吉
            $this->assign('fdarrzhux',I('globals.fdarrzhux'));//福德主星状况
            $this->assign('fdarrfuxz',I('globals.fdarrfuxz'));//福德副星状况坐命宫
            $this->assign('fdarrfuxd',I('globals.fdarrfuxd'));//福德副星状况对照
            $this->assign('fdarrfuxj',I('globals.fdarrfuxj'));//福德副星状况加会
            znzk(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('znzkwz',I('globals.znzkwz'));//子女状况
            $this->assign('znzkzx',I('globals.znzkzx'));//子女主星
            $this->assign('znzkjx',I('globals.znzkjx'));//子女吉星
            $this->assign('znzkxx',I('globals.znzkxx'));//子女凶星
            $this->assign('zngongwei',I('globals.zngongwei'));//子女宫位
            $this->assign('znxj',I('globals.znxj'));//子女宫位凶吉
            $this->assign('znarrzhux',I('globals.znarrzhux'));//子女主星状况
            $this->assign('znarrfuxz',I('globals.znarrfuxz'));//子女副星状况坐命宫
            $this->assign('znarrfuxd',I('globals.znarrfuxd'));//子女副星状况对照
            $this->assign('znarrfuxj',I('globals.znarrfuxj'));//子女副星状况加会
            fmgx(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('fmgxwz',I('globals.fmgxwz'));//父母状况
            $this->assign('fmgxzx',I('globals.fmgxzx'));//父母主星
            $this->assign('fmgxjx',I('globals.fmgxjx'));//父母吉星
            $this->assign('fmgxxx',I('globals.fmgxxx'));//父母凶星
            $this->assign('fmgongwei',I('globals.fmgongwei'));//父母宫位
            $this->assign('fmxj',I('globals.fmxj'));//父母宫位凶吉
            $this->assign('fmarrzhux',I('globals.fmarrzhux'));//父母主星状况
            $this->assign('fmarrfuxz',I('globals.fmarrfuxz'));//父母副星状况坐命宫
            $this->assign('fmarrfuxd',I('globals.fmarrfuxd'));//父母副星状况对照
            $this->assign('fmarrfuxj',I('globals.fmarrfuxj'));//父母副星状况加会
            xdgx(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('xdgxwz',I('globals.xdgxwz'));//兄弟状况
            $this->assign('xdgxzx',I('globals.xdgxzx'));//兄弟主星
            $this->assign('xdgxjx',I('globals.xdgxjx'));//兄弟吉星
            $this->assign('xdgxxx',I('globals.xdgxxx'));//兄弟凶星
            $this->assign('xdgongwei',I('globals.xdgongwei'));//兄弟宫位
            $this->assign('xdxj',I('globals.xdxj'));//兄弟宫位凶吉
            $this->assign('xdarrzhux',I('globals.xdarrzhux'));//兄弟主星状况
            $this->assign('xdarrfuxz',I('globals.xdarrfuxz'));//兄弟副星状况坐命宫
            $this->assign('xdarrfuxd',I('globals.xdarrfuxd'));//兄弟副星状况对照
            $this->assign('xdarrfuxj',I('globals.xdarrfuxj'));//兄弟副星状况加会
            tzjj(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('tzjjwz',I('globals.tzjjwz'));//田宅状况
            $this->assign('tzjjzx',I('globals.tzjjzx'));//田宅主星
            $this->assign('tzjjjx',I('globals.tzjjjx'));//田宅吉星
            $this->assign('tzjjxx',I('globals.tzjjxx'));//田宅凶星
            $this->assign('tzgongwei',I('globals.tzgongwei'));//田宅宫位
            $this->assign('tzxj',I('globals.tzxj'));//田宅宫位凶吉
            $this->assign('tzarrzhux',I('globals.tzarrzhux'));//田宅主星状况
            $this->assign('tzarrfuxz',I('globals.tzarrfuxz'));//田宅副星状况坐命宫
            $this->assign('tzarrfuxd',I('globals.tzarrfuxd'));//田宅副星状况对照
            $this->assign('tzarrfuxj',I('globals.tzarrfuxj'));//田宅副星状况加会
            rjgx(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('rjgxwz',I('globals.rjgxwz'));//部署状况
            $this->assign('rjgxzx',I('globals.rjgxzx'));//部署主星
            $this->assign('rjgxjx',I('globals.rjgxjx'));//部署吉星
            $this->assign('rjgxxx',I('globals.rjgxxx'));//部署凶星
            $this->assign('bsgongwei',I('globals.bsgongwei'));//部署宫位
            $this->assign('bsxj',I('globals.bsxj'));//部署宫位凶吉
            $this->assign('bsarrzhux',I('globals.bsarrzhux'));//部署主星状况
            $this->assign('bsarrfuxz',I('globals.bsarrfuxz'));//部署副星状况坐命宫
            $this->assign('bsarrfuxd',I('globals.bsarrfuxd'));//部署副星状况对照
            $this->assign('bsarrfuxj',I('globals.bsarrfuxj'));//部署副星状况加会
            qyfz(I('globals.srg'),I('globals.arrzx'),I('globals.arrtf'),I('globals.arrjix'),I('globals.arrxiongx'),I('globals.shua'));
            $this->assign('qyfzwz',I('globals.qyfzwz'));//迁移状况
            $this->assign('qyfzzx',I('globals.qyfzzx'));//迁移主星
            $this->assign('qyfzjx',I('globals.qyfzjx'));//迁移吉星
            $this->assign('qyfzxx',I('globals.qyfzxx'));//迁移凶星
            $this->assign('qygongwei',I('globals.qygongwei'));//迁移宫位
            $this->assign('qyxj',I('globals.qyxj'));//迁移宫位凶吉
            $this->assign('qyarrzhux',I('globals.qyarrzhux'));//迁移主星状况
            $this->assign('qyarrfuxz',I('globals.qyarrfuxz'));//迁移副星状况坐命宫
            $this->assign('qyarrfuxd',I('globals.qyarrfuxd'));//迁移副星状况对照
            $this->assign('qyarrfuxj',I('globals.qyarrfuxj'));//迁移副星状况加会
            hualu(I('globals.shua'));
            $this->assign('hualu',I('globals.hualu'));//化禄
//            dump(I('globals.jkztjx'));
//            exit;
        }

//        $orderid=cookie('orderid');
//        $arrpre=M()->query("select * from tb_phone_or_email where orderid='{$_REQUEST['ordernum']}'");//查询是否绑定手机或者邮箱
//        if(empty($arrpre)){
//            $arrpre=M()->query("select * from tb_phone_or_email where orderid='{$orderid}'");
//        }
//        if(empty($arrpre[0]['id'])){$predata=1;}
//        $this->assign('predata',$predata);

        $this->assign('csName','ZW');
        $this->assign('channel',cookie('channel'));
        $this->assign('orderidnum',cookie('orderidnum'));
        $this->assign('sex',cookie('zsex'));
        $this->display("Zwds/ZM_ziweidoushu_zhifu_jieguoye");
    }
    public function zzhifu(){
        $data=M()->query("select status from sm_h5test where ordernum='".cookie('orderid')."'");
        $this->assign('status',$data[0]['status']);
        $this->display("Index/ZM_zzhifu");
    }
    public function pay(){//支付宝支付
        $this->assign('ordername1','紫微斗数');
        $this->assign('ordername2','知命-紫微斗数');
        $this->display("Index/pay");
    }

    public function paywx(){//H5微信支付
       // H5wxzhifu('ZW','紫微斗数',cookie('orderid'));//同乐
        H5ZMwxzhifu('ZW','紫微斗数',cookie('orderid'),'Zwds');//知命
    }

}